<?php
/**
 * @name IndexController
 * @author 6p2b7gaqkyoe4aw\administrator
 * @desc 默认控制器
 * @see http://www.php.net/manual/en/class.yaf-controller-abstract.php
 */
//error_reporting(E_ALL^E_NOTICE^E_WARNING);
include_once( 'BaseController.php' ); 
class WxpayController extends BaseController {

	
	public function PayAction() {
		$user=$this->checklogin2();
		$orderid=$info['orderid'] ? $info['orderid'] : $_REQUEST['orderid'];
		
		$ordermodel=new OrderModel();
		$where['oid=?']=$orderid;
		$order_one=$ordermodel->getone();
		if(!$order_one || !$order_one['price']){
			exit(json_encode(array('status'=>0,'info'=>'订单不存在')));
		}
		
		$sellermodel=new SellerModel();
		$swhere['id=?']=$order_one['sellerid'];
		$sellerone=$sellermodel->getone($swhere);
		if(!$sellerone){
			exit(json_encode(array('status'=>0,'info'=>'商家不存在')));
		}
		
		$where2['orderid=?']=$orderid;
		$order_goods_list=$ordermodel->order_goods_list($where2);
		if(!$order_goods_list){
			exit(json_encode(array('status'=>0,'info'=>'商品不存在')));
		}
		
		$url='http://'.$_SERVER['HTTP_HOST'].'/api/wxpay/jsapi.php?orderid=';
		//echo $url; die();
		header("location:$url");
	}
	
	
}
